package b_factorypattern.simple_factory;

/**
 *  有新的咖啡啥的，要修改工厂类
 */

public class SimpleCoffeeFactory {

    public Coffee createCoffee(String coffeeType){
        Coffee coffee = null ;
        if ("american".equals(coffeeType)){
            coffee = new AmericanCoffee() ;
        } else if ("latte".equals(coffeeType)) {
            coffee = new LatteCoffee() ;
        }else {
            throw new RuntimeException("sorry，没有你要的咖啡类型");
        }
        return coffee ;
    }
}
